import GCJ_CLASS_TYPE = require('./../../common/GCJ_CLASS_TYPE');
import Serializer = require('./../base/Serializer');
import SJGReplaceItemBase = require('./SJGReplaceItemBase');
import SJGReplaceItemText = require('./SJGReplaceItemText');
import CommonModel = require('./../../common/model/CommonModel');



var CONFIG=require('../../../../common/config');
export  = SJGReplaceItemTitleText;

/**
 * 普通正文／小标题
 * @author 
 *
 */
class SJGReplaceItemTitleText extends SJGReplaceItemText{
    
    // TextType 文字类型: 0普通正文／1小标题
    public tt: number = 0;
    
    public constructor(g?) {
        super(g);

        this.ct = GCJ_CLASS_TYPE.CLASS_TYPE_SJGReplaceItemTitleText;
        this.type = SJGReplaceItemBase.TYPE_TITLE_TEXT;
    }
    
    // 从json对象(注意不是json字符串)中解析
    public fromJson(jsonObj,versionId) {
        super.fromJson(jsonObj,versionId);
        
        if(jsonObj.hasOwnProperty('tt')) {
            this.tt=jsonObj.tt*1; 
        }
    }
    
    // 转成json字符串
    public toJson(): string {
        // 去掉父json字符串的头尾
        var superJson = super.toJson();
        superJson = superJson.substr(1,superJson.length - 2);

        var ret = '{';
        ret += superJson;
        
        // tt
        ret += ',';
        ret += '"tt":';
        ret += this.tt;
        
        ret += '}';
        return ret;
    }
    // 获取对象名称
    public getObjetName(): string {
//        0普通正文／1小标题
        return this.tt==0? "普通正文":"小标题";
    }

//SJG_MARK_APPEND--------------------

}//SJG_MARK_END-------------------------